import psutil
print("CPU:%d"%(psutil.cpu_count()))
print("CPU:%s%%"%(psutil.cpu_percent(0.5)))
phymem = psutil.virtual_memory()
line = "Memory: %5s%% %6s/%s"%(
    phymem.percent,
    str(int(phymem.used/1024/1024))+"M",
    str(int(phymem.total/1024/1024))+"M"
)
print(line)
for x in psutil.disk_partitions():
    line="%s总计：%.2fG 已使用：%.2fG 剩余：%.2fG"%(
        x.device,
        psutil.disk_usage(x.device).total/1024/1024/1024,
        psutil.disk_usage(x.device).used/1024/1024/1024,
        psutil.disk_usage(x.device).free/1024/1024/1024
        )
    print(line)
for name in psutil.net_io_counters(pernic=True):
    NICinfo=psutil.net_io_counters(psutil.net_io_counters(pernic=True))[name]
    line= "%s :\n\t接收：%.2fM发送：%.2fM"%(
        name,
        NICinfo.bytes_recv/1024/1024,
        NICinfo.bytes_sent/1024/1024,
        )
    print(line)
input()
